<template>
	<view class="page">

		<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" :top="'10rpx'" @up="upCallback">
			<!-- :down="downOption" :up="upOption" -->

			<uni-list>

				<view class="item" v-for="(item, index) in listdata" :key="index">

					<view style="height: 80rpx;display: flex;justify-content: space-between;align-items: center;margin-right: 20rpx;">
						<text class="title">
							车辆订单号：{{item.businessNo}}
						</text>

						<text style="font-size: 26rpx;color: #FFC500;">{{item.statusStr}}</text>
					</view>


					<u-line color="#efefef" :customStyle="{'margin-bottom': '30rpx','display': 'block',}"></u-line>

					<view class="text-line">
						<text class="text-name">租赁类型:</text>
						<text class="text-value">{{item.rentTypeStr|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">租期:</text>
						<text
							class="text-value">{{item.timeStartRent|filterNull}}至{{item.timeFinishRent|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">车牌号:</text>
						<text class="text-value">{{item.carPlateNo|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">品牌/车系/车型:</text>
						<text class="text-value">{{item.brandSeriesModelName|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">收款类型:</text>
						<text class="text-value">{{item.collectionTypeStr|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">应收金额:</text>
						<text class="text-value">¥{{item.receivableAmount|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">已收金额:</text>
						<text class="text-value">¥{{item.receivedAmount|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">待收金额:</text>
						<text class="text-value">¥{{item.uncollectedAmount|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">应收日期:</text>
						<text class="text-value">{{item.receivableDate|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name" style="color: #E93131;">逾期天数:</text>
						<text class="text-value" style="color: #E93131;">{{item.overdueDays|filterNull}}天</text>
					</view>

					<view v-if="receiveType==2">
						<u-line color="#efefef" :customStyle="{'margin-bottom': '30rpx','display': 'block',}"></u-line>

						<view class="text-line">
							<text class="text-name">支付类型:</text>
							<text class="text-value">{{item.paymentTypeStr|filterNull}}</text>
						</view>

						<view class="text-line">
							<text class="text-name">收款确认时间:</text>
							<text class="text-value">{{item.actualDate|filterNull}}</text>
						</view>

						<view class="text-line">
							<text class="text-name">操作人:</text>
							<text class="text-value">{{item.createUserName|filterNull}}</text>
						</view>
					</view>

				</view>
			</uni-list>

		</mescroll-uni>


	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";

	export default {
		mixins: [MescrollMixin],
		components: {},
		data() {
			return {
				page: 1,
				listdata: [],
				customerId: '',
				orderCarId: '',
				receiveType: '',
				businessType: '',
			}
		},
		onLoad(op) {
			this.customerId = op.customerId;
			this.orderCarId = op.orderCarId;
			this.receiveType = op.receiveType;
			this.businessType = op.businessType;
			// this.getData();
			
			uni.setNavigationBarTitle({
				title:1==this.receiveType?'应收账单':'已收账单'
			})
		},
		methods: {
			getData() {
				
				let params = 1==this.businessType?{
					pageNo: this.page,
					customerId: this.customerId,
					businessType: this.businessType,
					receiveType: this.receiveType,
				}:{
					pageNo: this.page,
					inParameter: this.orderCarId,
					businessType: this.businessType,
					receiveType: this.receiveType,
				}

				this.$u.api.getCustomerReceivablesList(params).then(
						res => {
							if (this.page == 1) {

                this.listdata = [];
              }
              this.listdata = this.listdata.concat(res);
              this.mescroll.endSuccess(res.length);
            }
					)
					.catch(() => {
						this.mescroll.endErr();
					})
			},

			upCallback(page) {
				console.log("触发了上拉加载" + page);

				this.page = page.num;
				this.getData();
			},



		}
	}
</script>

<style lang="scss">
	.page {
		background-color: $grayf5;
	}

	.item {
		display: flex;
		flex-direction: column;
		background-color: white;
		border-radius: 8rpx;
		margin: 10rpx 20rpx;
		padding-bottom: 10rpx;
	}

	.title {
		width: 80%;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 28rpx;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
		color: $black33;
		margin-left: 20rpx;
	}

	.text-warn {
		font-size: 24rpx;
		color: $rede9;
		margin-right: 20rpx;
	}

	.text-warn-orange {
		color: $yellowffc;
	}

	.btn-detail {
		width: 180rpx;
		height: 60rpx;
		border-radius: 50rpx;
		color: white;
		text-align: center;
		background-color: $blue15;
		font-size: 26rpx;
		line-height: 60rpx;
		margin: 10rpx 20rpx 10rpx;
		align-self: flex-end;
	}
</style>
